//
//  ItemTableViewCell.m
//  Demo
//
//  Created by colawh on 2019/3/18.
//  Copyright © 2019年 colawhdfws. All rights reserved.
//

#import "ItemTableViewCell.h"
#import "Header.h"
#import "DemoHelp.h"
@interface ItemTableViewCell ()

@property (nonatomic,strong) UILabel *titleLb;

@property (nonatomic,strong) UITextField *detailtf;

@end

@implementation ItemTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configUI];
    }
    return self;
}
- (void)setTileStr:(NSString *)title detailStr:(NSString *)detailStr{
    _titleLb.text = title;
    _detailtf.text = detailStr;
}
- (void)configUI{
    [self.contentView addSubview:self.titleLb];
    [self.contentView addSubview:self.detailtf];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    CGFloat leftGap = 50;
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(leftGap);
        make.right.equalTo(self);
        make.height.mas_equalTo(24);
        make.bottom.equalTo(self.mas_centerY).offset(-5);
    }];
    [_detailtf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(_titleLb);
        make.height.mas_equalTo(22);
        make.top.equalTo(self.mas_centerY).offset(5);
    }];
}
- (UILabel *)titleLb{
    if (!_titleLb) {
        _titleLb = [DemoHelp getLbByFont:14];
        _titleLb.textColor = kUIColorFromRGB(0x091522);
    }
    return _titleLb;
}
- (UITextField *)detailtf{
    if (!_detailtf) {
        _detailtf = [[UITextField alloc]init];
        _detailtf.leftViewMode = UITextFieldViewModeAlways;
        _detailtf.textColor = kUIColorFromRGBA(0x091522,0.55);
        _detailtf.font = [UIFont systemFontOfSize:12.0];
        UIImageView *leftIcon = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 15, 15)];
        leftIcon.image = [UIImage imageNamed:@"logo_sj"];
        _detailtf.leftView = leftIcon;
        _detailtf.userInteractionEnabled = NO;
    }
    return _detailtf;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
